home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Archive / Networking / GetZoneList / GetZoneList.r < prev    next >
Encoding:
Text File  |  2000-09-28  |  6.6 KB  |  304 lines  |  [TEXT/MPS ]

  1. /*-----------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    AppleTalk GetZoneList Sample Application
  6. #
  7. #    GetZoneList
  8. #
  9. #    GetZoneList.r    -    Rez Source
  10. #
  11. #    Copyright © 1988-1990 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.00                November 1988
  15. #                1.01                October 1989
  16. #                1.02                May 1990
  17. #                1.03                June 1992
  18. #                1.04                July 1992
  19. #
  20. #    Components:    GetZoneList.c        May 1, 1990
  21. #                GetZoneList.p        May 1, 1990
  22. #                GetZoneList.r        May 1, 1990
  23. #                MakeFile            May 1, 1990
  24. #                UFailure.a            November 1, 1988
  25. #                UFailure.h            November 1, 1988
  26. #                UFailure.inc1.p        November 1, 1988
  27. #                UFailure.p            November 1, 1988
  28. #
  29. #    GetZoneList is a sample application that uses
  30. #    AppleTalk ATP and ZIP to obtain a list of zones
  31. #    on an AppleTalk internet.
  32. #
  33. #    GetZoneList also demonstrates using a signal, or
  34. #    failure-catching mechanism to recover from error
  35. #    situations.
  36. #
  37. #    GetZoneList is based on DTS Sample.p. For more
  38. #    description and explanantion of the non-example
  39. #    specific areas of this application, please refer to
  40. #    either Sample.p or TESample.p.
  41. #
  42. # -----------------------------------------------------------------------------*/
  43.  
  44. #include "Types.r"
  45.  
  46.  
  47. #define kMinSize    62        /* application's minimum size (in K) */
  48. #define kPrefSize    66        /* application's preferred size (in K) */
  49.  
  50. #define    rAboutAlert    128        /* about alert */
  51. #define rZoneDialog    129        /* zone list dialog */
  52. #define rUserAlert    130        /* error alert */
  53.  
  54. #define    sErrStrings    128        /* error strings STR# ID */
  55.  
  56. #define    rMenuBar    128        /* application's menu bar */
  57.  
  58. #define    mApple        128        /* Apple menu */
  59.  
  60. #define    mFile        129        /* File menu */
  61.  
  62. #define    mEdit        130        /* Edit menu */
  63.  
  64. /* these #defines are used to set enable/disable flags of a menu */
  65.  
  66. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  67. #define NoItems        0b0000000000000000000000000000000
  68. #define MenuItem1    0b0000000000000000000000000000001
  69. #define MenuItem2    0b0000000000000000000000000000010
  70. #define MenuItem3    0b0000000000000000000000000000100
  71. #define MenuItem4    0b0000000000000000000000000001000
  72. #define MenuItem5    0b0000000000000000000000000010000
  73. #define MenuItem6    0b0000000000000000000000000100000
  74. #define MenuItem7    0b0000000000000000000000001000000
  75. #define MenuItem8    0b0000000000000000000000010000000
  76. #define MenuItem9    0b0000000000000000000000100000000
  77. #define MenuItem10    0b0000000000000000000001000000000
  78. #define MenuItem11    0b0000000000000000000010000000000
  79. #define MenuItem12    0b0000000000000000000100000000000
  80.  
  81.  
  82. /* we use an MBAR resource to conveniently load all the menus */
  83.  
  84. resource 'MBAR' (rMenuBar, preload) {
  85.     { mApple, mFile, mEdit };    /* three menus */
  86. };
  87.  
  88.  
  89. resource 'MENU' (mApple, preload) {
  90.     mApple, textMenuProc,
  91.     AllItems & ~MenuItem2,        /* Disable dashed line, enable About and DAs */
  92.     enabled, apple,
  93.     {
  94.         "About GetZoneList…",
  95.             noicon, nokey, nomark, plain;
  96.         "-",
  97.             noicon, nokey, nomark, plain
  98.     }
  99. };
  100.  
  101. resource 'MENU' (mFile, preload) {
  102.     mFile, textMenuProc,
  103.     MenuItem1 | MenuItem12,        /* enable Quit and New only, program enables others */
  104.     enabled, "File",
  105.     {
  106.         "New",
  107.             noicon, "N", nomark, plain;
  108.         "Open",
  109.             noicon, "O", nomark, plain;
  110.         "-",
  111.             noicon, nokey, nomark, plain;
  112.         "Close",
  113.             noicon, "W", nomark, plain;
  114.         "Save",
  115.             noicon, "S", nomark, plain;
  116.         "Save As…",
  117.             noicon, nokey, nomark, plain;
  118.         "Revert",
  119.             noicon, nokey, nomark, plain;
  120.         "-",
  121.             noicon, nokey, nomark, plain;
  122.         "Page Setup…",
  123.             noicon, nokey, nomark, plain;
  124.         "Print…",
  125.             noicon, nokey, nomark, plain;
  126.         "-",
  127.             noicon, nokey, nomark, plain;
  128.         "Quit",
  129.             noicon, "Q", nomark, plain
  130.     }
  131. };
  132.  
  133. resource 'MENU' (mEdit, preload) {
  134.     mEdit, textMenuProc,
  135.     NoItems,                    /* disable everything, program does the enabling */
  136.     enabled, "Edit",
  137.      {
  138.         "Undo",
  139.             noicon, "Z", nomark, plain;
  140.         "-",
  141.             noicon, nokey, nomark, plain;
  142.         "Cut",
  143.             noicon, "X", nomark, plain;
  144.         "Copy",
  145.             noicon, "C", nomark, plain;
  146.         "Paste",
  147.             noicon, "V", nomark, plain;
  148.         "Clear",
  149.             noicon, nokey, nomark, plain
  150.     }
  151. };
  152.  
  153. /* this ALRT and DITL are used as an About screen */
  154.  
  155. resource 'ALRT' (rAboutAlert) {
  156.     {40, 20, 160, 292}, rAboutAlert, {
  157.         OK, visible, silent;
  158.         OK, visible, silent;
  159.         OK, visible, silent;
  160.         OK, visible, silent
  161.     };
  162. };
  163.  
  164. resource 'DITL' (rAboutAlert) {
  165.      {
  166.         {88, 180, 108, 260},
  167.         Button {
  168.             enabled,    "OK"
  169.         };
  170.         {8, 8, 24, 214},
  171.         StaticText {
  172.             disabled,    "GetZoneList"
  173.         };
  174.         {32, 8, 48, 237},
  175.         StaticText {
  176.             disabled,    "© 1989-90 Apple Computer, Inc."
  177.         };
  178.         {56, 8, 72, 136},
  179.         StaticText {
  180.             disabled,    "Brought to you by:"
  181.         };
  182.         {80, 24, 112, 167},
  183.         StaticText {
  184.             disabled,    "Macintosh Developer " $"CA" "Technical Support"
  185.         }
  186.     }
  187. };
  188.  
  189.  
  190. /* this DLOG and DITL are used for the Zone List dialog */
  191.  
  192. resource 'DLOG' (rZoneDialog) {
  193.     {100, 100, 290, 400},
  194.     dBoxProc,
  195.     invisible,
  196.     noGoAway,
  197.     0x0,
  198.     rZoneDialog,
  199.     ""
  200. };
  201.  
  202. resource 'DITL' (rZoneDialog) {
  203.     {
  204.         {160, 220, 180, 280},
  205.         Button {
  206.             enabled,
  207.             "OK"
  208.         },
  209.         {20, 20, 148, 280},
  210.         UserItem {
  211.             enabled
  212.         },
  213.         {160, 220, 180, 280},
  214.         UserItem {
  215.             disabled
  216.         }
  217.     }
  218. };
  219.  
  220.  
  221. /* this ALRT and DITL are used as an error screen */
  222.  
  223. resource 'ALRT' (rUserAlert, purgeable) {
  224.     {40, 20, 180, 260},
  225.     rUserAlert,
  226.     { /* array: 4 elements */
  227.         /* [1] */
  228.         OK, visible, silent,
  229.         /* [2] */
  230.         OK, visible, silent,
  231.         /* [3] */
  232.         OK, visible, silent,
  233.         /* [4] */
  234.         OK, visible, silent
  235.     }
  236. };
  237.  
  238.  
  239. resource 'DITL' (rUserAlert, purgeable) {
  240.     { /* array DITLarray: 4 elements */
  241.         /* [1] */
  242.         {110, 150, 130, 230},
  243.         Button {
  244.             enabled,
  245.             "OK"
  246.         },
  247.         /* [2] */
  248.         {10, 60, 60, 230},
  249.         StaticText {
  250.             disabled,
  251.             "Error. ^0."
  252.         },
  253.         /* [3] */
  254.         {70, 60, 90, 230},
  255.         StaticText {
  256.             disabled,
  257.             "^1"
  258.         },
  259.         /* [4] */
  260.         {8, 8, 40, 40},
  261.         Icon {
  262.             disabled,
  263.             2
  264.         }
  265.     }
  266. };
  267.  
  268.  
  269. resource 'STR#' (sErrStrings, purgeable) {
  270.     {
  271.     "An error occurred. The error number is: ";
  272.     "You must run on 512Ke or later";
  273.     "Application Memory Size is too small";
  274.     "Not enough memory to run GetZoneList";
  275.     "An AppleTalk-related error occurred";
  276.     "There are no zones"
  277.     }
  278. };
  279.  
  280.  
  281. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  282.  
  283. resource 'SIZE' (-1) {
  284.     dontSaveScreen,
  285.     acceptSuspendResumeEvents,
  286.     enableOptionSwitch,
  287.     canBackground,                /* we can background; we don't currently, but our sleep value */
  288.                                 /* guarantees we don't hog the Mac while we are in the background */
  289.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  290.     backgroundAndForeground,    /* this is definitely note a background-only application! */
  291.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  292.     ignoreChildDiedEvents,
  293.     is32BitCompatible,
  294.     reserved,
  295.     reserved,
  296.     reserved,
  297.     reserved,
  298.     reserved,
  299.     reserved,
  300.     reserved,
  301.     kPrefSize * 1024,
  302.     kMinSize * 1024
  303. };
  304.